package com.example.demo.poc.executor;

import com.alibaba.fastjson.JSON;
import com.example.demo.poc.domain.CIMObjectConfig;
import com.example.demo.poc.domain.CIMObjectPlainValue;
import com.example.demo.poc.domain.DataSetConfig;
import com.example.demo.poc.domain.StrategyExchanger;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Executor {
    public static void main(String[] args) {
        List<DataSetConfig> dsConfigList = null;
        CIMObjectConfig cimObjectConfig = new CIMObjectConfig();



        StrategyExchanger exchange = new StrategyExchanger();
        try {
            dsConfigList =  exchange.readJsonStrategyConfig(new File("C:\\Users\\shink\\OneDrive\\DI\\design\\doc\\strategy.jsonc"),"UTF8");

        } catch (IOException e) {
            e.printStackTrace();
        }

        cimObjectConfig.setDatasetsConfig(dsConfigList);

        ContextProcessor ctxProc = null;
        try {
            ctxProc = new ContextProcessor(new File("C:\\Users\\shink\\OneDrive\\DI\\design\\doc\\SZTXDB-QT0000-0039.json"),"UTF8");
        } catch (IOException e) {
            e.printStackTrace();
        }

        FormulaProcessor frmProc = new FormulaProcessor();

        StrategyExecutor se = new StrategyExecutor(cimObjectConfig,ctxProc,frmProc);
        CIMObjectPlainValue cimObjectPlainValue = se.changeCIMObjectConfigtoValue();
        System.out.println(JSON.toJSON(cimObjectPlainValue));

    }
}
